module.exports = function(window, document) {
	var apivm = require('../../common/avm.min')(window, document);
	var avm = apivm;
	var api = apivm.api;
	var Component = apivm.Component;
	var $ = apivm.$;
	(function() {
	var Tabbar = /*@__PURE__*/ (function(Component) {
		function Tabbar(props) {
			Component.call(this, props);
			this.data = {};
		}

		if (Component) Tabbar.__proto__ = Component;
		Tabbar.prototype = Object.create(Component && Component.prototype);
		Tabbar.prototype.constructor = Tabbar;
		Tabbar.prototype.apiready = function() {};
		Tabbar.prototype.goPage = function(pagename) {
			var pagePath = {
				index: "../index/index",
				friend: "../friend/friend",
				message: "../message/message",
				me: "../me/me",
				addVideo: "../addVideo/addVideo"
			};

			wx.redirectTo({url: pagePath[pagename]});
		};
		Tabbar.prototype.render = function() {
			var this$1 = this;
			return apivm.h(
				"view",
				{class: "tabbar"},
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "index" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("index");
						}
					},
					"首页"
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "friend" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("friend");
						}
					},
					"朋友"
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						onClick: function() {
							return this$1.goPage("addVideo");
						}
					},
					apivm.h("image", {src: "../../image/add.png"})
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "message" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("message");
						}
					},
					"消息"
				),
				apivm.h(
					"view",
					{
						class: "tab-item",
						style: {color: this.props.active == "me" ? "#fff" : "#bbb"},
						onClick: function() {
							return this$1.goPage("me");
						}
					},
					"我"
				)
			);
		};

		return Tabbar;
	})(Component);
	apivm.define("tabbar", Tabbar);

	var Me = /*@__PURE__*/ (function(Component) {
		function Me(props) {
			Component.call(this, props);
			this.data = {
				user: {
					nickname: "老陈打码",
					headimg: "https://a415432669.github.io/shortvideo/000.jpg",
					user_desc: "让学习编程更简单！",
					like: "13.5w",
					follow: "256",
					fans: "13.8w",
					works: [
						{
							id: "000",
							nickname: "老陈打码",
							content: "新年快乐，万事如意！",
							like: "3.5w",
							share: "3821",
							collect: "2988",
							comment: "3475",
							playnum: "3.5w",
							isLike: false,
							pubtime: "2022-01-10 01:30",
							headimg: "https://a415432669.github.io/shortvideo/000.jpg",
							src: "https://a415432669.github.io/shortvideo/000.mp4",
							poster: "https://a415432669.github.io/shortvideo/poster0.jpg"
						},

						{
							id: "001",
							nickname: "学习通知",
							content: "快乐学习APICloud多端应用开发",
							like: "3.5w",
							share: "3821",
							collect: "2988",
							comment: "3475",
							playnum: "3.5w",
							isLike: false,
							pubtime: "2022-01-10 01:30",
							headimg: "https://a415432669.github.io/shortvideo/001.jpg",
							src: "https://a415432669.github.io/shortvideo/001.mp4",
							poster: "https://a415432669.github.io/shortvideo/poster1.jpg"
						},

						{
							id: "002",
							nickname: "小清新",
							content: "感谢每一个我们打开世界的人",
							like: "3.5w",
							share: "3821",
							collect: "2988",
							comment: "3475",
							playnum: "3.5w",
							isLike: false,
							pubtime: "2022-01-10 01:30",
							headimg: "https://a415432669.github.io/shortvideo/002.jpg",
							src: "https://a415432669.github.io/shortvideo/002.mp4",
							poster: "https://a415432669.github.io/shortvideo/poster2.jpg"
						},

						{
							id: "003",
							nickname: "琦琦",
							content: "当你来到世界，他就拥有了超能力！致伟大的父亲",
							like: "3.5w",
							share: "3821",
							collect: "2988",
							comment: "3475",
							playnum: "3.5w",
							isLike: false,
							pubtime: "2022-01-10 01:30",
							headimg: "https://a415432669.github.io/shortvideo/003.jpg",
							src: "https://a415432669.github.io/shortvideo/003.mp4",
							poster: "https://a415432669.github.io/shortvideo/poster3.jpg"
						},

						{
							id: "004",
							nickname: "老陈打码",
							content: "虎年大吉，虎虎生财好运来！",
							like: "3.5w",
							share: "3821",
							collect: "2988",
							comment: "3475",
							isLike: false,
							pubtime: "2022-01-10 01:30",
							headimg: "https://a415432669.github.io/shortvideo/004.jpg",
							src: "https://a415432669.github.io/shortvideo/004.mp4",
							poster: "https://a415432669.github.io/shortvideo/poster4.jpg"
						}
					]
				}
			};
		}

		if (Component) Me.__proto__ = Component;
		Me.prototype = Object.create(Component && Component.prototype);
		Me.prototype.constructor = Me;
		Me.prototype.apiready = function() {
			var this$1 = this;
			//like created
			api.ajax(
				{
					url:
						"https://a6197037785854-dev.apicloud-saas.com/api/users/getUser?nickname=" +
						"老陈打码"
				},
				function(ret, err) {
					api.ajax(
						{
							url:
								"https://a6197037785854-dev.apicloud-saas.com/api/videos/getUserVideo?obj=" +
								JSON.stringify({nickname: "老陈打码"})
						},
						function(ret2, err) {
							// console.log(ret)
							ret2.data.forEach(function(item) {
								if (item.playnum > 10000) {
									item.playnum = item.playnum / 10000;
									item.playnum = item.playnum.toFixed(1) + "万";
								}
							});
							this$1.data.user = Object.assign({}, ret.data, {works: ret2.data});
						}
					);
					api.ajax(
						{
							url:
								"https://a6197037785854-dev.apicloud-saas.com/api/videos?filter=" +
								JSON.stringify({where: {nickname: "老陈打码"}})
						},
						function(ret, err) {
							console.log(ret);
						}
					);
				}
			);
		};
		Me.prototype.render = function() {
			return apivm.h(
				"view",
				{class: "page"},
				apivm.h(
					"view",
					{class: "header"},
					apivm.h("view", {
						class: "bg",
						style: {background: "url(" + this.data.user.headimg + ")"}
					}),

					apivm.h(
						"view",
						{class: "info"},
						apivm.h(
							"view",
							{class: "img"},
							apivm.h("image", {src: this.data.user.headimg})
						),
						apivm.h(
							"div",
							{class: "infoList"},
							apivm.h(
								"div",
								{class: "info-item"},
								apivm.h("view", {class: "key"}, "获赞"),
								apivm.h("view", {class: "value"}, this.data.user.like)
							),
							apivm.h(
								"div",
								{class: "info-item"},
								apivm.h("view", {class: "key"}, "关注"),
								apivm.h("view", {class: "value"}, this.data.user.follow)
							),
							apivm.h(
								"div",
								{class: "info-item"},
								apivm.h("view", {class: "key"}, "粉丝"),
								apivm.h("view", {class: "value"}, this.data.user.fans)
							)
						)
					),

					apivm.h("view", {class: "username"}, this.data.user.nickname),
					apivm.h("view", {class: "user_desc"}, this.data.user.user_desc)
				),

				apivm.h(
					"view",
					{class: "works"},
					apivm.h("view", {class: "title"}, "作品"),
					apivm.h(
						"view",
						{class: "work_list"},
						(Array.isArray(this.data.user.works)
							? this.data.user.works
							: Object.values(this.data.user.works)
						).map(function(work, index$1) {
							return apivm.h(
								"div",
								{class: "work_item"},
								apivm.h("image", {src: work.poster}),
								apivm.h(
									"view",
									{class: "info"},
									apivm.h("image", {src: "../../image/pause_border.png"}),
									apivm.h("view", {class: "num"}, work.playnum)
								)
							);
						})
					)
				),

				apivm.h("tabbar", {active: "me"})
			);
		};

		return Me;
	})(Component);
	apivm.define("me", Me);
	apivm.render(apivm.h("me", null), "body");
})();

	window['createApp'] = function() {
		apivm.$_start();
	}
	return avm;
}